$(function() {

	$('#localStorage_teacher_name').val(localStorage.teacher_name);
	$('#localStorage_teacher_phone').val(localStorage.teacher_phone);
	$('#yue_messages_type').val(localStorage.yue_messages_type);
    var today = $.grep(localStorage.today.split(","),function(n){
		return $.trim(n).length > 0;
	});
	var tomorrow = $.grep(localStorage.tomorrow.split(","),function(n){
		return $.trim(n).length >0;
	});
	var after = $.grep(localStorage.after.split(","),function(n){
		return $.trim(n).length >0;
	});
        var myDate = new Date();//获取系统当前时间
        var seperator1 = "-";
        var month = myDate.getMonth()+1;
             //後天
        if(after[0]==1){
            var strDate = myDate.getDate()+2;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"06:45:00";
        }
        if(after[0]==2){
            var strDate = myDate.getDate()+2;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"08:05:00";
        }
        if(after[0]==3){
            var strDate = myDate.getDate()+2;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"09:25:00";
        }
        if(after[0]==4){
            var strDate = myDate.getDate()+2;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"10:45:00";
        }
        if(after[0]==5){
            var strDate = myDate.getDate()+2;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"12:05:00";
        }
        if(after[0]==6){
            var strDate = myDate.getDate()+2;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"13:25:00";
        }
        if(after[0]==7){
            var strDate = myDate.getDate()+2;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"14:45:00";
        }
        if(after[0]==8){
            var strDate = myDate.getDate()+2;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"16:05:00";
        }
        if(after[0]==9){
            var strDate = myDate.getDate()+2;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"17:25:00";
        }
        //明天
        if(tomorrow[0]==1){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"06:45:00";
        }
        if(tomorrow[0]==2){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"08:05:00";
        }
        if(tomorrow[0]==3){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"09:25:00";
        }
        if(tomorrow[0]==4){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"10:45:00";
        }
        if(tomorrow[0]==5){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"12:05:00";
        }
        if(tomorrow[0]==6){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"13:25:00";
        }
        if(tomorrow[0]==7){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"14:45:00";
        }
        if(tomorrow[0]==8){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"16:05:00";
        }
        if(tomorrow[0]==9){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"17:25:00";
        }
        //今天
        if(today[0]==1){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"06:45:00";
        }
        if(today[0]==2){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"08:05:00";
        }
        if(today[0]==3){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"09:25:00";
        }
        if(today[0]==4){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"10:45:00";
        }
        if(today[0]==5){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"12:05:00";
        }
        if(today[0]==6){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"13:25:00";
        }
        if(today[0]==7){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"14:45:00";
        }
        if(today[0]==8){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"16:05:00";
        }
        if(today[0]==9){
            var strDate = myDate.getDate()+1;
        var time = myDate.getFullYear() + seperator1 + month + seperator1 + strDate+" "+"17:25:00";
        }

       $('#order_time').val(time);


	$('.submit_final').click(function() {
		var address = $('#address').val();
		var order_time = $('#order_time').val();
		var yue_messages = $('#yue_messages').val();
		if($("#yue_messages").val() == ""){
			layer.msg("留言不能为空");
			return false;
		}else{
			localStorage.yue_messages = $("#yue_messages").val();
		}

		if(address == '') {
			layer.msg('请输入地址');
			return;
		}
		if(order_time == '') {
			layer.msg('请选择接送时间');
			return;
		}
		localStorage.address = address;
		localStorage.order_time = order_time;
		window.location.href = "../payment/teacher_pay.html"
	});
})

/*点击返回回退事件*/
function goback() {
	history.back();
}
